<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><title>狼族少年、血狼</title><meta name="author" content="狼族少年、血狼"><meta name="copyright" content="狼族少年、血狼"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="狼族少年、血狼">
<meta property="og:url" content="https://geekwolfman.github.io/page/5/index.html">
<meta property="og:site_name" content="狼族少年、血狼">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png">
<meta property="article:author" content="狼族少年、血狼">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png"><link rel="shortcut icon" href="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png"><link rel="canonical" href="https://geekwolfman.github.io/page/5/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/db.json","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: true,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '狼族少年、血狼',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-06-08 14:15:24'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pace-js/themes/blue/pace-theme-minimal.min.css"/><script src="https://cdn.jsdelivr.net/npm/pace-js/pace.min.js"></script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">14</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-images"></i><span> 画廊</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-paper-plane"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/pages/01index.png')"><nav id="nav"><span id="blog-info"><a href="/" title="狼族少年、血狼"><span class="site-name">狼族少年、血狼</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-images"></i><span> 画廊</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-paper-plane"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">狼族少年、血狼</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/15/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%B8%89%E7%AB%A0%E3%80%91%EF%BC%9AAOP.html" title="Spring高级45讲【第三章】：AOP"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%B8%89%E7%AB%A0%E3%80%91%EF%BC%9AAOP/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Spring高级45讲【第三章】：AOP"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/15/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%B8%89%E7%AB%A0%E3%80%91%EF%BC%9AAOP.html" title="Spring高级45讲【第三章】：AOP">Spring高级45讲【第三章】：AOP</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-15T13:34:57.000Z" title="发表于 2023-04-15 21:34:57">2023-04-15</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-15T13:40:46.213Z" title="更新于 2023-04-15 21:40:46">2023-04-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%8E%9F%E7%90%86%E6%8E%A2%E7%A9%B6/">原理探究</a></span></div><div class="content">代理增强方式aspectj编译器增强先看一组例子：
pom.xml文件中增加插件：
123456789101112131415161718192021222324&lt;plugin&gt;    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;    &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;    &lt;version&gt;1.14.0&lt;/version&gt;    &lt;configuration&gt;        &lt;complianceLevel&gt;1.8&lt;/complianceLevel&gt;        &lt;source&gt;8&lt;/source&gt;        &lt;target&gt;8&lt;/target&gt;        &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt;        &lt;verbose&gt;true&lt;/verbo ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/15/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%BA%8C%E7%AB%A0%E3%80%91%EF%BC%9AIOC.html" title="Spring高级45讲【第二章】：IOC"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%BA%8C%E7%AB%A0%E3%80%91%EF%BC%9AIOC/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Spring高级45讲【第二章】：IOC"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/15/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%BA%8C%E7%AB%A0%E3%80%91%EF%BC%9AIOC.html" title="Spring高级45讲【第二章】：IOC">Spring高级45讲【第二章】：IOC</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-15T12:12:45.000Z" title="发表于 2023-04-15 20:12:45">2023-04-15</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-15T12:53:13.666Z" title="更新于 2023-04-15 20:53:13">2023-04-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%8E%9F%E7%90%86%E6%8E%A2%E7%A9%B6/">原理探究</a></span></div><div class="content">容器接口以SpringBoot的启动类为例：
123456@SpringBootApplicationpublic class A01&#123;    public static void main(String[] args) &#123;        SpringApplication.run(A01.class, args);    &#125;&#125;

容器启动的run()方法是有返回值的：
1ConfigurableApplicationContext context = SpringApplication.run(A01.class, args);

在 IDEA 中使用快捷键Ctrl +Alt +U查看 ConfigurableApplicationContext 类的类图:

ConfigurableApplicationContext接口继承了ApplicationContext接口，而
ApplicationContext 接口又间接地继承了BeanFactory 接口，除此之外还继承了其他很多接口，相当于对BeanFactory 进行了拓展。
到底什么是 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/15/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%B8%80%E7%AB%A0%E3%80%91%EF%BC%9A%E5%AF%BC%E5%AD%A6.html" title="Spring高级45讲【第一章】：导学"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%B8%80%E7%AB%A0%E3%80%91%EF%BC%9A%E5%AF%BC%E5%AD%A6/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Spring高级45讲【第一章】：导学"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/15/Spring%E9%AB%98%E7%BA%A745%E8%AE%B2%E3%80%90%E7%AC%AC%E4%B8%80%E7%AB%A0%E3%80%91%EF%BC%9A%E5%AF%BC%E5%AD%A6.html" title="Spring高级45讲【第一章】：导学">Spring高级45讲【第一章】：导学</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-15T12:07:49.000Z" title="发表于 2023-04-15 20:07:49">2023-04-15</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-15T12:30:00.279Z" title="更新于 2023-04-15 20:30:00">2023-04-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%8E%9F%E7%90%86%E6%8E%A2%E7%A9%B6/">原理探究</a></span></div><div class="content">参考视频：黑马程序员Spring视频教程，深度讲解spring5底层原理
源码仓库：spring-test
学习Spring的必须性？

Spring是整个Java体系最核心的框架，没有之一
面试必备(spring的核心原理、springmvc的执行流程、springboot的自动装配…)
技术、思想提升(设计模式、高新技术发展…)

阅读源码的错误姿势？

对Spring功能还不了解，还不会用呢，却要强读。不要轻易装B，轻则耗费心神，重则挫败放弃。先会用，再研究。
没有目的，一上来就debug，看到哪分析到哪。没有目的的debug，会让你迷失在源码当中，翻一百遍也是枉然。明确要研究的问题，带着问题看代码。
不分主次，分析一个问题时，引入另一个陌生问题。抓住重点，逐个击破。
只讲源码功能，不做单元测试。眼过千遍，不如手过一遍

如何学习Spring？

了解要研究的组件（类）基本使用
用单元测试研究组件的特性
试着自己实现类似功能（选讲）
最后再深入阅读该组件的源码（避免讲）

需要具备的前置知识？

Spring的基础知识
想探究Spring原理的好奇心

学习Spring有什么收获 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/12/%E5%B9%B6%E6%9F%A5%E9%9B%86%E7%9A%84%E4%BB%8B%E7%BB%8D.html" title="并查集的介绍"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E5%B9%B6%E6%9F%A5%E9%9B%86%E7%9A%84%E4%BB%8B%E7%BB%8D/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="并查集的介绍"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/12/%E5%B9%B6%E6%9F%A5%E9%9B%86%E7%9A%84%E4%BB%8B%E7%BB%8D.html" title="并查集的介绍">并查集的介绍</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-12T02:20:31.000Z" title="发表于 2023-04-12 10:20:31">2023-04-12</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-12T02:40:07.896Z" title="更新于 2023-04-12 10:40:07">2023-04-12</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span></div><div class="content">并查集定义
并查集是一种树型的数据结构，用于处理一些不相交集合（disjoint sets）的合并及查询问题。
并查集通常包含两种操作
查找(Find)：查询两个元素是否在同一个集合中
合并(Union)：把两个不相交的集合合并为一个集合



并查集思想请看以下示例：116. 省份数量
有n个城市，其中一些彼此相连，另一些没有相连。如果城市a与城市b直接相连，且城市b与城市c直接相连，那么城市a与城市c间接相连。
省份 是一组直接或间接相连的城市，组内不含其他没有相连的城市。
给出一个n x n的矩阵isConnected，其中isConnected[i][j] = 1表示第i个城市和第j个城市直接相连，而isConnected[i][j] = 0表示二者不直接相连。
给出任意的两个城市i和j，判断是否为同一省份。
并查集的思想就是将每个城市看作一个节点，如果节点之间有联系，那么就选择一个节点为其父节点，例如：

若节点0和1有关联，那么随机选择0作为1的父节点：

若1和2有关联，那么就找到1的根节点0，即0与2有关联，随机选择0作为父节点：

同理，3与4有关联，我们选择4为父节 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/11/%E5%B0%8F%E4%BA%8En%E7%9A%84%E6%9C%80%E5%A4%A7%E6%95%B0.html" title="小于n的最大数"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E5%B0%8F%E4%BA%8En%E7%9A%84%E6%9C%80%E5%A4%A7%E6%95%B0/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="小于n的最大数"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/11/%E5%B0%8F%E4%BA%8En%E7%9A%84%E6%9C%80%E5%A4%A7%E6%95%B0.html" title="小于n的最大数">小于n的最大数</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-11T02:32:45.000Z" title="发表于 2023-04-11 10:32:45">2023-04-11</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-11T02:36:39.453Z" title="更新于 2023-04-11 10:36:39">2023-04-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E7%AE%97%E6%B3%95%E7%BB%83%E4%B9%A0/">算法练习</a></span></div><div class="content">题目描述数组nums中给定可以使用的1~9的数，返回由数组nums中的元素组成的小于n的最大数。
示例 1：
12输入：nums = &#123;1, 2, 9, 4&#125;，n = 2533输出：2499

示例 2：
12输入：nums = &#123;1, 2, 5, 4&#125;，n = 2543输出：2542

示例 3：
12输入：nums = &#123;1, 2, 5, 4&#125;，n = 2541输出：2525

示例 4：
12输入：nums = &#123;1, 2, 9, 4&#125;，n = 2111输出：1999

示例 5：
12输入：nums = &#123;5, 9&#125;，n = 5555输出：999

示例 6：
12输入：nums = &#123;5, 9&#125;，n = 3输出：-1

我的解法思路
对每一位先尝试使用相同数字
如果没有相同数字，判断是否存在比当前数字更小的数字，如果有，则选择更小数字中的最大数，剩余的数字用最大数字
如果没有，向前查找前一个数字有没有更小的数字
直到回溯到第一个数字，就用位数更少但全部都是最 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/11/%E6%87%82%E8%BD%A6%E5%B8%9D%E4%BA%8C%E9%9D%A2%E5%A4%8D%E7%9B%98.html" title="懂车帝二面复盘"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E6%87%82%E8%BD%A6%E5%B8%9D%E4%BA%8C%E9%9D%A2%E5%A4%8D%E7%9B%98/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="懂车帝二面复盘"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/11/%E6%87%82%E8%BD%A6%E5%B8%9D%E4%BA%8C%E9%9D%A2%E5%A4%8D%E7%9B%98.html" title="懂车帝二面复盘">懂车帝二面复盘</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-11T02:20:13.000Z" title="发表于 2023-04-11 10:20:13">2023-04-11</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-05-06T13:24:28.928Z" title="更新于 2023-05-06 21:24:28">2023-05-06</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E9%9D%A2%E8%AF%95%E7%BB%8F%E9%AA%8C/">面试经验</a></span></div><div class="content">时间：2023年04月10日 17:00
场景数据推送到内存中，如何做到不产生并发问题。
请看以下示例：
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889public class Main &#123;    public static void main(String[] args) throws InterruptedException &#123;        Test test = new Test();        Thread readThread = new Thread(new Runnable1(test));        readThread.start();        Thread writeThread = new Thread(new Runnable2(test) ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/04/Java%E4%B8%ADi=i-%E9%97%AE%E9%A2%98.html" title="Java中i=i++问题"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/Java%E4%B8%ADi%3Di%2B%2B%E9%97%AE%E9%A2%98/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java中i=i++问题"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/04/Java%E4%B8%ADi=i-%E9%97%AE%E9%A2%98.html" title="Java中i=i++问题">Java中i=i++问题</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-04T09:07:40.000Z" title="发表于 2023-04-04 17:07:40">2023-04-04</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-16T15:39:04.164Z" title="更新于 2023-04-16 23:39:04">2023-04-16</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/java/">java</a></span></div><div class="content">猜猜以下代码的输出：
1234567891011public class Test &#123;    public static void main(String[] args) &#123;        int i = 0;        for (int j = 0; j &lt; 100; j++) &#123;            i = i++;        &#125;        System.out.println(&quot;result = &quot; + i);    &#125;&#125;

输出为：
1result = 0

刚开始还以为是答案错误，在idea中运行了一下发现，还真是这样。
按照一般的思路，i &#x3D; i ++ 应该分为两步:

i &#x3D; i 
i ++

结果应该为：
1result = 100

上网查了一下：
i &#x3D; i ++ 的步骤其实分为三步：

把变量i的值取出来，放在一个临时变量里(记作temp)；
把变量i的值进行自加操作；
把临时变量temp的值作为自增运算前i的值使用;

经过以上三步操 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/04/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95.html" title="排序算法"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="排序算法"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/04/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95.html" title="排序算法">排序算法</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-04T08:50:53.000Z" title="发表于 2023-04-04 16:50:53">2023-04-04</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-04T08:59:23.067Z" title="更新于 2023-04-04 16:59:23">2023-04-04</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E7%AE%97%E6%B3%95%E5%AD%A6%E4%B9%A0/">算法学习</a></span></div><div class="content">算法概述排序算法可以分为内部排序和外部排序，内部排序是数据记录在内存中进行排序，而外部排序是因排序的数据很大，一次不能容纳全部的排序记录，在排序过程中需要访问外存。
常见的内部排序算法有：插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。用一张图概括：

各算法对比：

冒泡排序算法思想冒泡排序（Bubble Sort）也是一种简单直观的排序算法。它重复地走访过要排序的数列，一次比较两个元素，如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换，也就是说该数列已经排序完成。这个算法的名字由来是因为越小的元素会经由交换慢慢”浮”到数列的顶端。
算法步骤
比较相邻的元素。如果第一个比第二个大，就交换他们两个。
对每一对相邻元素作同样的工作，从开始第一对到结尾的最后一对，数组末尾会形成有序区
针对无序区域元素重复以上的步骤，最多重复数组长度-1次

代码实现12345678910111213141516/** * 原始实现 * * @param array */public static void sort1(int[] array) ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/04/%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E9%81%8D%E5%8E%86.html" title="二叉树的遍历"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E9%81%8D%E5%8E%86/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="二叉树的遍历"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/04/%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E9%81%8D%E5%8E%86.html" title="二叉树的遍历">二叉树的遍历</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-03T16:02:54.000Z" title="发表于 2023-04-04 00:02:54">2023-04-04</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-04T02:19:56.729Z" title="更新于 2023-04-04 10:19:56">2023-04-04</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span></div><div class="content">二叉树（binary tree）是树的一种特殊形式。二叉，顾名思义，这种树的每个节点最多有2个孩子节点。注意，这里是最多有2个，也可能只有1个，或者没有孩子节点。
代码定义：
123456789101112/** * 二叉树 */private static class TreeNode &#123;    int data;    TreeNode leftChild;    TreeNode rightChild;    public TreeNode(int data) &#123;        this.data = data;    &#125;&#125;

深度优先遍历递归遍历前序遍历二叉树的前序遍历，输出顺序是根节点、左子树、右子树。
12345678910111213/** * 前序遍历 * * @param root */public static void preOrderTraversal(TreeNode root) &#123;    if (root == null) &#123;        return;    &#125;    System.o ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/03/%E4%BA%8C%E5%8F%89%E6%9F%A5%E6%89%BE%E6%A0%91.html" title="二叉查找树"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E4%BA%8C%E5%8F%89%E6%9F%A5%E6%89%BE%E6%A0%91/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="二叉查找树"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/03/%E4%BA%8C%E5%8F%89%E6%9F%A5%E6%89%BE%E6%A0%91.html" title="二叉查找树">二叉查找树</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-04-03T15:54:18.000Z" title="发表于 2023-04-03 23:54:18">2023-04-03</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-03T15:58:23.827Z" title="更新于 2023-04-03 23:58:23">2023-04-03</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span></div><div class="content">二叉查找树定义二叉排序树（Binary Sort Tree），又称二叉查找树（Binary Search Tree），亦称二叉搜索树。是数据结构中的一类。在一般情况下，查询效率比链表结构要高。
一棵空树，或者是具有下列性质的二叉树：
（1）若左子树不空，则左子树上所有结点的值均小于它的根结点的值；
（2）若右子树不空，则右子树上所有结点的值均大于它的根结点的值；
（3）左、右子树也分别为二叉排序树；
（4）没有键值相等的结点。
二叉查找树的中序遍历按照升序进行排序。
定义节点类：
123456789101112/** * 结点类 */private class Node &#123;    int data;    Node right;    Node left;    Node(int data) &#123;        this.data = data;    &#125;&#125;

查找123456789101112131415161718192021/** * 查找结点 * * @param data * @return */public Node search(in ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/4/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/4/#content-inner">4</a><span class="page-number current">5</span><a class="page-number" href="/page/6/#content-inner">6</a><a class="extend next" rel="next" href="/page/6/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">狼族少年、血狼</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">14</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://wpa.qq.com/msgrd?v=3&amp;uin=2370032534&amp;site=qq&amp;menu=yes&amp;jumpflag=1"><i class="fa-brands fa-qq"></i><span>添加博主QQ</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">本站所有博文均是博主的学习笔记与个人理解，来源于网络，如有<span style="color:red;font-weight:bold;">侵权</span>请<a target="_blank" rel="noopener" href="https://wpa.qq.com/msgrd?v=3&uin=2370032534&site=qq&menu=yes&jumpflag=1" style="color:#49B1F5;font-weight:bold">联系我</a>进行删除🥰。</div></div><div class="sticky_layout"><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">57</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2023-03-21T16:00:00.000Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">173k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-06-08T06:15:23.179Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 狼族少年、血狼</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"><script>window.typedJSFn = {
  init: (str) => {
    window.typed = new Typed('#subtitle', Object.assign({
      strings: str,
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50,
    }, null))
  },
  run: (subtitleType) => {
    if (true) {
      if (typeof Typed === 'function') {
        subtitleType()
      } else {
        getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
      }
    } else {
      subtitleType()
    }
  }
}
</script><script>function subtitleType () {
  fetch('https://v1.hitokoto.cn')
    .then(response => response.json())
    .then(data => {
      if (true) {
        const from = '出自 ' + data.from
        const sub = []
        sub.unshift(data.hitokoto, from)
        typedJSFn.init(sub)
      } else {
        document.getElementById('subtitle').innerHTML = data.hitokoto
      }
    })
}
typedJSFn.run(subtitleType)
</script></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="false"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></body></html>